
local objects = {}

local function CreateRangeFrame()
	local frame = CreateFrame"Frame"
	frame.timer = 0
	frame:SetScript("OnUpdate", function(self, elapsed)
		local timer = self.timer + elapsed

		if timer >= .25 then
			for object in pairs(objects) do
				if object:IsShown() then
					if UnitInRange(object.unit) then
						object:SetAlpha(1)
					else
						object:SetAlpha(.5)
					end
				end
			end
			timer = 0
		end
		self.timer = timer
	end)
	CreateRangeFrame = nil
end

oUF.subTypes["Range"] = function (object)
	if CreateRangeFrame then
		CreateRangeFrame()
	end
	objects[object] = true
end
